home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / dfue / term 4.6(?) / extras / source / gtlayout-source.lha / LTP_SizeDimensions.c < prev    next >
C/C++ Source or Header  |  1996-03-18  |  2KB  |  94 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14.  
  15. /*****************************************************************************/
  16.  
  17.  
  18. STATIC VOID
  19. LTP_GetSizeDimensions(LayoutHandle *Handle,ULONG *SizeWidth,ULONG *SizeHeight)
  20. {
  21.     Object    *SizeImage;
  22.     LONG     SizeType;
  23.  
  24.     if(Handle->Screen->Flags & SCREENHIRES)
  25.     {
  26.         if(SizeWidth)
  27.             *SizeWidth = 18;
  28.  
  29.         if(SizeHeight)
  30.             *SizeHeight = 10;
  31.  
  32.         SizeType = SYSISIZE_MEDRES;
  33.     }
  34.     else
  35.     {
  36.         if(SizeWidth)
  37.             *SizeWidth = 13;
  38.  
  39.         if(SizeHeight)
  40.             *SizeHeight = 11;
  41.  
  42.         SizeType = SYSISIZE_LOWRES;
  43.     }
  44.  
  45.     if(SizeImage = NewObject(NULL,SYSICLASS,
  46.         SYSIA_Size,        SizeType,
  47.         SYSIA_Which,    SIZEIMAGE,
  48.         SYSIA_DrawInfo,    Handle->DrawInfo,
  49.     TAG_DONE))
  50.     {
  51.         if(SizeWidth)
  52.             GetAttr(IA_Width,SizeImage,SizeWidth);
  53.  
  54.         if(SizeHeight)
  55.             GetAttr(IA_Height,SizeImage,SizeHeight);
  56.  
  57.         DisposeObject(SizeImage);
  58.     }
  59. }
  60.  
  61.  
  62. /*****************************************************************************/
  63.  
  64.  
  65. ULONG
  66. LTP_GetSizeWidth(struct LayoutHandle *handle)
  67. {
  68.     ULONG SizeWidth;
  69.  
  70.     LTP_GetSizeDimensions(handle,&SizeWidth,NULL);
  71.  
  72.     if(SizeWidth < handle->Screen->WBorRight)
  73.         return(handle->Screen->WBorRight);
  74.     else
  75.         return(SizeWidth);
  76. }
  77.  
  78.  
  79. /*****************************************************************************/
  80.  
  81.  
  82. ULONG
  83. LTP_GetSizeHeight(struct LayoutHandle *handle)
  84. {
  85.     ULONG SizeHeight;
  86.  
  87.     LTP_GetSizeDimensions(handle,NULL,&SizeHeight);
  88.  
  89.     if(SizeHeight < handle->Screen->WBorBottom)
  90.         return(handle->Screen->WBorBottom);
  91.     else
  92.         return(SizeHeight);
  93. }
  94.